package com.snow.useviewdemo.kotlin

/**
 * Created by zhyt
 * Date: 2022/9/5
 * Describe:
 */
class RepositoryTest
private constructor() {
    private var users: MutableList<User>? = null

    init {
        val user1 = User("Jane", "")
        val user2 = User("John", null)
        val user3 = User("Anne", "Doe")
        users = ArrayList<User>()
        users?.add(user1)
        users?.add(user2)
        users?.add(user3)
    }

    fun getUserList(): List<User>? {
        return users
    }

    companion object {
        private var INSTANCE: RepositoryTest? = null
        val instance: RepositoryTest?
            get() {
                if (INSTANCE == null) {
                    synchronized(RepositoryTest::class.java) {
                        if (INSTANCE == null) {
                            INSTANCE = RepositoryTest()
                        }
                    }
                }
                return INSTANCE
            }
    }
}
